import * as constants from '../Constants'
import { get, GET_SECORD_SUBMIT_LIST, GET_SECORD_SUBMIT_BY_ID } from '../../service/api'

export interface GetSecordSubmitList {
  type: constants.GetSecordSubmitList
  payload: Promise<any>
}
export interface GetSecordSubmitList_PENDING {
  type: constants.GetSecordSubmitList_PENDING
  payload: Promise<any>
}
export interface GetSecordSubmitList_FULFILLED {
  type: constants.GetSecordSubmitList_FULFILLED
  payload: any
}
export interface GetSecordSubmitList_Type {
  type: constants.GetSecordSubmitList_Type
  payload: number
}

export interface RECORD_SecordSubmit {
  type: constants.RECORD_SecordSubmit
  payload: Promise<any>
}

export interface RECORD_SecordSubmit_FULFILLED {
  type: constants.RECORD_SecordSubmit_FULFILLED
  payload: any
}

export type SecordSubmitAction = GetSecordSubmitList | 
  GetSecordSubmitList_FULFILLED | 
  GetSecordSubmitList_PENDING |
  GetSecordSubmitList_Type |
  RECORD_SecordSubmit |
  RECORD_SecordSubmit_FULFILLED

export function recordType(param: number): GetSecordSubmitList_Type {
  return {
    type: constants.GetSecordSubmitList_Type,
    payload: param
  }
}

export function recoreMakes(params: any): RECORD_SecordSubmit {
  return {
    type: constants.RECORD_SecordSubmit,
    payload: get(GET_SECORD_SUBMIT_BY_ID, params)
  }
}

export function getSecordSubmitList(param: any): GetSecordSubmitList {
  return {
    type: constants.GetSecordSubmitList,
    payload: get(GET_SECORD_SUBMIT_LIST, param)
  }
}